package act

import (
	"net/http"
	"net/http/httputil"
	"time"
)

type Retriever struct {
	UserAgent string
	Timeout time.Duration
}

//使用组合接口时。act.Retriever和mock.Retriever都必须实现Post方法和Get方法
func (r *Retriever) Post(form map[string]string) string{
	return "ok"
}

func (r *Retriever) Get(url string) string{
	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}

	bytes, err := httputil.DumpResponse(resp,true)

	resp.Body.Close()
	if err != nil {
		panic(err)
	}
	return string(bytes)
}